package cn.itzzx.lagou.minicat.servlet;

import cn.itzzx.lagou.minicat.request.Request;
import cn.itzzx.lagou.minicat.response.Response;

import java.io.IOException;

/**
 * TODO
 *
 * @author Martin
 * @since 1.0
 */
public abstract class HttpServlet implements Servlet {

    public abstract void doGet(Request request,Response response) throws IOException, InterruptedException;

    public abstract void doPost(Request request,Response response) throws IOException;

    @Override
    public void init() throws Exception {

    }

    @Override
    public void destory() throws Exception {

    }

    @Override
    public void service(Request request, Response response) throws Exception {
        if("GET".equalsIgnoreCase(request.getMethod())){
            doGet(request,response);
        }else{
            doPost(request,response);
        }
    }
}
